package com.hl.secondHand.common.lang;

import cn.hutool.json.JSONUtil;
import lombok.Data;

import java.io.Serializable;

/*
    自定义返回值类型
 */
@Data
public class Result implements Serializable {
    private int code;   //200为正常 非200为不正常
    private String msg;
    private Object data;

    public Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result succes(Object data) {
        return new Result(200, "成功", data);
    }

    public static Result fail(String msg) {
        return new Result(400, msg, null);
    }
}
